/*
 * @(#)XfvhdlScriptXstFile.java        3.0                    2004/09/14
 *
 * This file is part of Xfuzzy 3.0, a design environment for fuzzy logic
 * based systems.
 *
 * (c) 2000 IMSE-CNM. The authors may be contacted by the email address:
 *                    xfuzzy-team@imse.cnm.es
 *
 * Xfuzzy is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Xfuzzy is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

package xfuzzy.xfvhdl;

/**
* Clase que genera el fichero de script Script.xst
* @author Jos� Mar�a �vila Maireles, <b>e-mail</b>: josavimai@alum.us.es
* @version 3.0
*/
public class XfvhdlScriptXstFile {

   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
   //			  M�TO_DOS P�BLICOS DE LA CLASE				        
   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//

   /**
   * M�todo que crea la cadena que ser� escrita en el fichero Script.xst
   * @return Devuelve la cadena que ser� escrita en el fichero Script.xst
   */
   public String createScriptXstSource() {

      XfvhdlHeadFile head =
         new XfvhdlHeadFile(
            XfvhdlProperties.fileDir,
            XfvhdlProperties.outputFile + "Script.xst",
            XfvhdlProperties.ficheroXFL);

      String code = head.getScriptHead();

      code += "\nset -tmpdir .\n"
         + "set -xsthdpdir "
         + XfvhdlProperties.outputDirectory
         + XfvhdlProperties.fileSeparator
         + XfvhdlProperties.outputFile
         + "_synthesis\n"
         + "run\n"
         + "-ifmt VHDL\n"
         + "-ifn "
         + XfvhdlProperties.outputDirectory
         + XfvhdlProperties.outputFile
         + ".prj\n"
         + "-ent FLC\n"
         + "-ofmt NGC\n"
         + "-ofn "
         + XfvhdlProperties.outputDirectory
         + XfvhdlProperties.outputFile
         + "_synthesis\\"
         + XfvhdlProperties.outputFile
         + ".ngc\n"
         + "-p "
         + XfvhdlProperties.partType
         + "\n"
         + "-keep_hierarchy Yes\n"
         + "-write_timing_constraints Yes\n";

      if (XfvhdlProperties.memoryType.equals((String) "ROM"))
         code += "-rom_extract Yes\n";
      else
         code += "-rom_extract No\n";

      code += "-ram_extract Yes\n";

      if (XfvhdlProperties.memoryType.equals((String) "RAM-Block"))
         code += "-ram_style Block\n";

      if (XfvhdlProperties.memoryType.equals((String) "RAM-Distributed"))
         code += "-ram_style Distributed\n";

      if (XfvhdlProperties.speedOptimization == true)
         code += "-opt_mode Speed\n";

      if (XfvhdlProperties.areaOptimization == true)
         code += "-opt_mode Area\n";

      if (XfvhdlProperties.mapEffort.equals((String) "HIGH_MAP_EFFORT"))
         code += "-opt_level 2\n";
      else
         code += "-opt_level 1\n";

      return code;
   }

} // Fin de la clase
